<?php

use Biz\service\BrandRights\BrandLevelRightsService;

class LevelRightsLeaveInfoAction extends ActionPlugin
{

    const USER_LEVEL = self::LEVEL_REGISTER;

    const VALIDATOR_TOAST_DEBUG = true;

    //参数校验-规则
    public const VALIDATOR_RULES = [
        'rights_name' => 'require',
        'phone' => 'require',
    ];

    //参数校验-自定义消息
    public const VALIDATOR_MSG = [
        'rights_name.require' => '权益参数错误',
        'phone.require' => '请输入留资手机号',

    ];

    public function main()
    {
        $rights_name = $this->params['rights_name'];
        $phone = $this->params['phone'];
        $bRet = BrandLevelRightsService::leaveInfo($this->uid, $rights_name, $phone);
        if (!$bRet) {
            throw new \Exception('留资失败！',self::CODE_ERROR_VIEW_TOSTA);
        }
        $this->setSuccess('success');
    }
}